<?php
session_start();
if (isset($_POST['name']) && isset($_POST['school'])){
    include '../c/config.php';
    $openid='';
    if (isset($_SESSION['openid'])) {
         $openid=$_SESSION['openid'];
    }
    $name=trim($_POST['name']);
    $school=(int)trim($_POST['school']);
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqli->error);}
    $mysqli->query("INSERT INTO `uinfo` (`id`, `openid`,`name`, `school`,`createtime`) VALUES (NULL,'".$openid."','".$name."', '".$school."', '".date("Y-m-d H:i:s")."')");
    $mysqli->close();
    
    if ($school < 20) {
    	 $xiaoqu='lg';
    }else{
         $xiaoqu='mh';
    }

    echo json_encode(array('s'=>'y', 'x'=>$xiaoqu));
}else{
    echo json_encode(array('s'=>'n'));
}

?>


